package com.demo.service.impl;

import com.demo.dao.BugStatisticMapper;
import com.demo.service.BugStatisticService;
import com.demo.vo.BugStatistic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BugStatisticImpl implements BugStatisticService {
    @Autowired
    private BugStatisticMapper bugStatisticMapper;

    @Override
    public List<BugStatistic> countByColumn(String columnName){
        List<BugStatistic> list = null;
        //根据不同的columnName，调用不同的方法
        if (columnName.equals("funcId")) {
            list = bugStatisticMapper.countByFuncId();
        } else if (columnName.equals("bugLevel")) {
            list = bugStatisticMapper.countByBugLevel();
        }else if (columnName.equals("fromUser")) {
            list = bugStatisticMapper.countByFormUser();
        }else if (columnName.equals("status")) {
            list = bugStatisticMapper.countByStatus();
        }
        return list;
    }
}
